<template>
  <div class="row-image">
    <div class="content">
      <div
        :class="['title', tags.length > 0 ? 'van-ellipsis' : 'van-multi-ellipsis--l2']"
      >{{ title }}</div>
      <div class="tags">
        <van-tag
          v-for="(item, index) in tags"
          :key="index"
          plain
          color="#4586ff"
          :style="{ marginRight: '8px' }"
        >{{ item }}</van-tag>
      </div>
      <div class="footer">
        <div>
          <span class="author">{{ author }}</span>
          <span class="time">{{ time }}</span>
        </div>
        <div class="read">
          <van-icon name="eye-o" :style="{ marginRight: '6px' }" />
          {{ read }}W阅读
        </div>
      </div>
    </div>

    <div class="cover">
      <img :src="cover" />
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Icon, Tag } from 'vant'

Vue.use(Icon).use(Tag)

export default {
  props: {
    cover: {
      type: String,
      default: ''
    },

    title: {
      type: String,
      default: ''
    },

    author: {
      type: String,
      default: ''
    },

    time: {
      type: String,
      default: ''
    },

    read: {
      type: [Number, String],
      default: ''
    },

    tags: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style lang="less" scoped>
.row-image {
  padding: 15px 0;
  margin: 0 17px;
  border-top: 0.5px solid #eeeeee;
  display: flex;
  background-color: #ffffff;

  .cover {
    width: 100px;
    height: 75px;
    margin-left: 14px;

    img {
      width: 100px;
      height: 75px;
      border-radius: 4px;
    }
  }

  .content {
    flex: 1;
    max-width: calc(100% - 114px);
    display: flex;
    flex-flow: column;
    justify-content: space-between;

    .title {
      font-size: 17px;
      color: #444444;
    }

    .footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 10px;
      color: #dddddd;

      .author {
        font-size: 11px;
        color: #666666;
        margin-right: 8px;
      }

      .time {
        font-size: 11px;
        color: #dddddd;
      }

      .read {
        display: flex;
        align-items: center;
      }
    }
  }
}
</style>